<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*
                                                let person = {
                                                    name: 'zhangsan',
                                                    age: '20'
                                                };
                                                let {
                                                    name,
                                                    age
                                                } = person;
                                                console.log(name); //'zhangsan'
                                                console.log(age); //'20'
                                        */



        /*
                let person = {
                    name: 'zhangsan',
                    age: '20'
                };
                let {
                    name: myname,
                    age: myage
                } = person;
                console.log(myname); //'zhangsan'
                console.log(myage); //'20'
                */





        let person = {
            name: 'zhangsan',
            age: '20',
            hobby: ['篮球', '足球', '排球']
        };

        // es6 中 对象 如果可以跟val相同  可以只写一个
        let {
            name: name, //name
            age: age, //age
            hobby: hobby //hobby
        } = person;
        console.log(name); //'zhangsan'
        console.log(age); //'20'
        console.log(hobby); //['篮球','足球','排球']
    </script>

</body>

</html>